#include <iostream>
#include <unistd.h>
#include <signal.h>
using namespace std;

typedef void (*sighandler_t)(int);
void sigcb(int sigid)
{
    cout << "Catch No." << sigid << " signal" << endl;
}

int main()
{
    signal(2, sigcb);
    int cnt = 0;
    while (1)
    {
        cout << "I'm a process.My pis is " << getpid() << "." << endl;
        sleep(2);
        ++cnt;
    }
    return 0;
}
